﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Linq;
using Microsoft.SharePoint;

namespace CSSoft.VNTower.Domain
{
    [Serializable]
    public class BaseItem
    {
        public int Id { get; set; }
        public string Title { get; set; }
        public SPFieldLookupValue LookupValue
        {
            get { return new SPFieldLookupValue(Id, Title); }
            set { if (value == null) return; Id = value.LookupId; Title = value.LookupValue; }
        }
        public string StrLookupValue { get { return LookupValue.ToString(); } }
        [NonSerialized]
        private SPListItem _item;
        public SPListItem Item
        {
            get { return _item; }
            set
            {
                _item = value;
                if (_item == null) return;
                Id = _item.ID;
                Title = _item.Title;
            }
        }
    }
}
